#include "HttpServer.hpp"
#include "Err.hpp"
#include <memory>

static void usage(std::string proc)
{
    std::cout << "Usage:\n\t" << proc << " serverport\n"
              << std::endl;
}

//const &：输入型参数
//*: 输出型参数
//&：输入输出型参数
std::string HandlerHttp(const std::string& message)
{
    //message一定是完整的http请求报文
    //得给客户端返回http响应response


    return "";
}


int main(int args, char* argv[])
{
    if(args != 2)
    {
        usage(argv[0]);
        exit(USAGE_ERR);
    }

    uint16_t port = atoi(argv[1]);

    std::unique_ptr<HttpServer> hs(new HttpServer(HandlerHttp, port));
    hs->ServerInit();
    hs->Start();

    return 0;
}